package com.itheima.api.set.demo01;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class SetDemo {

    public static void main(String[] args) {

        Set<String> stringSet = new TreeSet<String>();

        stringSet.add("避尘");
        stringSet.add("朔月");
        stringSet.add("裂冰");

        Iterator<String> iterator = stringSet.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }
        System.out.println("----------------");

        for (String s : stringSet){
            System.out.println(s);
        }
        System.out.println("------------------");

        stringSet.forEach(s -> System.out.println(s));
    }
}
